package com.gather.setting;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class Example01 {
    public static void main(String[] args) throws IOException {
        System.out.println("properties 配置文件读取测试");
        String f = "/Users/xiemingbao/Java/java-learning-directory/CommonClass/setting.properties";
        // 1.创建实例
        Properties properties = new Properties();
        //  2.调用load()读取文件
        properties.load(new FileInputStream(f));
        //  3.调用 getProperty(配置名称,默认值) 配置
        String filepath = properties.getProperty("last_open_file");
        System.out.println(filepath);// /data/hello.txt
        String auto_save_interval = properties.getProperty("auto_save_interval","120");
        System.out.println(auto_save_interval);// 60
    }
}
